Skip to content

fix(plugin-dashboard): a viewer whose every tile is refused sees one no-access panel, not a blank canvas - #27777

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-x22lgi
Oct 29, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-x22lgi

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC

Requested by Bill · project thread

Fixes #27491

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:观看者在仪表盘上的每个卡片都被服务器以读权限拒绝(403 / PERMISSION_DENIED)时,画布里显示一个「无权访问」面板(锁图标 + 标题 + 一句说明),不再是标题下一片空白;部分卡片被拒、设计模式、非权限错误的表现都不变。
  • 为什么改:CRM 的 Pipeline 仪表盘六个卡片共用一个数据集,普通成员打开只看到标题和「Refresh All」;维护者裁决 A(6508997538):保留逐卡隐藏,什么都不剩时说一次。
  • 风险与回滚:只动渲染层和十个语言包,不动 spec、服务端、DatasetWidget、DashboardView;403 仍是唯一判据。回滚即 revert 本 PR。
  • 先看:ui/packages/plugin-dashboard/src/DashboardRenderer.tsx(nothingLeftForViewer 与 allTilesRefusedPanel,桌面和移动两处挂载)→ 新测试 DashboardRenderer.allTilesRefused-27491.test.tsx → ui/packages/i18n/src/locales/en.ts 新键。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/DashboardRenderer.allTilesRefused-27491.test.tsx,预期 5/5 通过。
  • 需要你做的:无,席位落地。

What changes

Outside design mode, a dataset tile whose query the server refuses as a read refusal is left out of the dashboard for that viewer (the rule the spec states in the dashboard widget docblock). When that leaves nothing to draw, the viewer saw the dashboard header over an empty canvas, with no message. Ruling-ref: 6508997538 (maintainer ruling A).

  • DashboardRenderer renders its tiles once per layout (desktopTiles; metricTiles and otherTiles in the mobile stack) and asks nothingLeftForViewer(tiles): not design mode, at least one refused tile, at least one widget, and every rendered tile is null. The only null a tile renders is the refusal drop, so the trigger is exactly "every widget was left out as refused". A dashboard that still has any drawable widget (a non-dataset widget, a readable tile, a tile that failed for another reason) draws it and no panel.
  • The panel is the Empty composition the console draws for a dashboard the viewer may not open (dashboard-access-denied in DashboardView): lock icon, title dashboard.widgetForbiddenTitle, and one new message dashboard.allWidgetsForbiddenMessage. It carries data-testid="dashboard-all-widgets-forbidden" and spans the full grid (col-span-full). The header, its description and the refresh control are untouched.
  • @object-ui/i18n: dashboard.allWidgetsForbiddenMessage in all ten locales, beside widgetForbiddenMessage. en: "You don’t have permission to view the data behind this dashboard." (the typographic apostrophe the neighbouring dashboard.* strings use).

Tests

New ui/packages/plugin-dashboard/src/__tests__/DashboardRenderer.allTilesRefused-27491.test.tsx (5 tests), with the refusal shape AnalyticsForbiddenError carries (httpStatus: 403, code: 'PERMISSION_DENIED'):

  • every tile refused: the panel with both strings, both tiles queried, no tile title, no per-tile no-access face;
  • the same in the mobile layout (non-vacuity: the 2-column metric grid is drawn);
  • partial refusal: no panel, the readable tile present, the refused ones gone;
  • CONTROL design mode, every tile refused: no panel, each tile's objectui#10899 face present;
  • CONTROL a 400 on every tile: no panel, every tile and its error alert present.

DashboardRenderer.refusedTile-26971.test.tsx and DatasetWidget.forbiddenState-10899.test.tsx pass unchanged.

Readings
  • Premise (before the ruling, report 6508422494): the real examples/app-crm pipeline_dashboard through the real ObjectStackAdapter with fetch answering 403 PERMISSION_DENIED rendered an empty canvas; ablating the refusal drop brought the six frames back. Scratch test, never committed.
  • Ablation of this change, through scripts/ablation-replace.mjs on commit 76be307: the trigger's tiles.length > 0 && tiles.every((tile) => tile == null) replaced by false (anchor 1 → 0, blob c9adcbb0354a → eb6c069cbd78): the two all-refused tests red, the three others green (2 failed / 3 passed); restored, blob == HEAD c9adcbb0354a, git diff HEAD empty. The test imports the renderer by relative path, so no dist leg.
  • After merging main (head 24bc0b9), closure pnpm --filter '@object-ui/plugin-dashboard^...' build VERDICT command-exit 0; pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-dashboard/ packages/i18n/: Test Files 286 passed (286), Tests 3266 passed, 19 skipped; lock VERDICT command-exit 0.
  • Gates: see the os-dev-report on Dashboard: a viewer whose analytics queries are all refused 403 sees a blank canvas under the title (CRM Pipeline Dashboard as a plain member), with no per-widget refusal #27491.

Acceptance notes

  • The trigger is "nothing left to draw", not "every dataset tile refused", per the ruling: a dashboard that keeps any other widget draws no panel.
  • A refused tile is still not re-queried until remount; "Refresh All" stays as fix(plugin-dashboard): leave a tile out when the server refuses its data to the viewer #27065 left it (ruling item 2).
  • Option C of the ruling (the CRM app declaring requiredPermissions on pipeline_dashboard and its nav item) is a separate app-lane card, not this PR.

Verification

pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/DashboardRenderer.allTilesRefused-27491.test.tsx packages/plugin-dashboard/src/__tests__/DashboardRenderer.refusedTile-26971.test.tsx packages/plugin-dashboard/src/__tests__/DatasetWidget.forbiddenState-10899.test.tsx → 3 files, 11 tests passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CXTsLkvW2GpvDwNQre


Generated by Claude Code

…no-access panel

Each refused dataset tile is still left out for the viewer. When that
leaves nothing to draw, the canvas shows one no-access panel in the face
the console uses for a refused dashboard, instead of the header over an
empty grid. Partial refusals, design mode and non-refusal failures are
unchanged. Adds dashboard.allWidgetsForbiddenMessage in ten locales.

Claude-Session: https://claude.ai/code/session_01Utp6CXTsLkvW2GpvDwNQre
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Oct 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC

席位核对

ACCEPT · head 24bc0b979f6d04c7f2e683aecf7902e3b73e47d5 · 2026-10-29T23:11Z

  1. Shape: draft → main, Fixes #27491, attribution block on top. 13 files:
    • plugin-dashboard/src/DashboardRenderer.tsx and one new test;
    • one new key in each of the ten locale packs;
    • changesets for @object-ui/plugin-dashboard and @object-ui/i18n, both patch.
      No assignee, no reviewer. No spec, DatasetWidget, DashboardView or examples/** change, as the ruling's item 4 requires.
  2. Ruling applied: maintainer ruling A (6508997538); the PR carries Ruling-ref. The seat read the diff against the ruling's items 1–4:
    • Item 1, trigger: !designMode && refusedTiles.size > 0 && tiles.length > 0 && tiles.every(tile => tile == null), over the tiles actually rendered. It is applied on the desktop grid and on the mobile body (metric and other tiles together).
    • Item 2, face: DashboardView's dashboard-access-denied Empty composition (lock icon, dashboard.widgetForbiddenTitle, the new dashboard.allWidgetsForbiddenMessage), data-testid="dashboard-all-widgets-forbidden". The header and Refresh All are unchanged.
    • Item 3, pins: all refused → panel; mobile all refused → panel; partial → no panel; design-mode CONTROL → every tile's own face and no panel; 400 CONTROL → error alerts and no panel. The ablation (trigger → false) turns the two panel cases red.
    • Partial refusal and the Dashboard widgets have no audience gate: a tile whose dataset the viewer cannot read draws a permission error, and no widget key can hide it from that viewer #26971 pins are unchanged (item 6).
  3. Gates (check-runs on this head): 44 success, 11 skipped, 0 red.
    • Named runs: Lint & Repo Gates 123783692920, TypeScript Type Check 123783293734, Test UI 123786962558, Lint · PM dispatch-gates 123780996617.
    • The dev's derived gates: 34/34 run, 0 NOT-MEASURED.
    • plugin-dashboard + i18n: 286 files / 3266 tests on the merged head.
  4. Contract review: not owed. Clause-②: no: no exported shape changes, and the i18n packs gain a key only. Metadata-protocol: none.
  5. Accepted deviations / out of scope:
  6. Landing: not governed (check-governed-merges --pr 27777: NOT governed), +227 / −5 < 3000. The seat lands it: ready + auto-merge now.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant